package crawler;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Line2D;

public class GraphLink
{
    private GraphNode mNode1;
    private GraphNode mNode2;
    
    public GraphLink(GraphNode node1, GraphNode node2)
    {
        mNode1 = node1;
        mNode2 = node2;
    }
    
    public void Draw(Graphics2D g)
    {
        Line2D line = new Line2D.Float(mNode1.GetPosition(), mNode2.GetPosition());
        g.setStroke(new BasicStroke(0.25f));
        g.setColor(Color.BLACK);
        g.draw(line);
    }
    
    public boolean equals(Object other)
    {
    	if(!other.getClass().equals(GraphLink.class))
    	{
    		return false;
    	}
    	
    	GraphLink otherLink = (GraphLink)other;
    	if(!mNode1.equals(otherLink.mNode1) && !mNode1.equals(otherLink.mNode2))
    	{
    		return false;
    	}
    	if(!mNode2.equals(otherLink.mNode1) && !mNode2.equals(otherLink.mNode2))
    	{
    		return false;
    	}
    	
    	return true;
    }
}
